package com.lesson02_OOP;

public class StaticClassTest {

    // 静态属性和变量首先加载
    private static StaticClassTest staticMemeber= new StaticClassTest();
    private String noStaticMemeber;
    static String name;

    {
        System.out.println("代码块");
    }

    public StaticClassTest() {
        System.out.println("构造函数");
    }

    static { // 静态块: 当StaticDemo.class 被首次加载到jvm虚拟机
        System.out.println("静态块");
    }


    public void printName() {
        System.out.println("name:"+name);
    }

    public static void main(String[] args) {
        StaticClassTest demo = new StaticClassTest();
        demo.name = "张三";
        StaticClassTest demo1 = new StaticClassTest();
        demo1.name = "李四";

        System.out.println(demo.name); //  李四
        System.out.println(demo1.name); // 李四
    }
}
